VERSION 5.00
Begin VB.Form frmNew 
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "Properties - New"
   ClientHeight    =   2595
   ClientLeft      =   2760
   ClientTop       =   3630
   ClientWidth     =   5355
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2595
   ScaleWidth      =   5355
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Begin VB.TextBox txtIP 
      Height          =   315
      Left            =   2220
      TabIndex        =   7
      Top             =   1200
      Width           =   2775
   End
   Begin VB.TextBox txtMAC 
      Height          =   315
      Left            =   2220
      TabIndex        =   5
      Top             =   720
      Width           =   2775
   End
   Begin VB.TextBox txtName 
      Height          =   315
      Left            =   2220
      TabIndex        =   3
      Top             =   240
      Width           =   2775
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "&Cancel"
      Height          =   375
      Left            =   3840
      TabIndex        =   1
      Top             =   2040
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "&OK"
      Height          =   375
      Left            =   2400
      TabIndex        =   0
      Top             =   2040
      Width           =   1215
   End
   Begin VB.Label lblIP 
      Caption         =   "IP Address:"
      Height          =   255
      Left            =   300
      TabIndex        =   6
      Top             =   1260
      Width           =   1815
   End
   Begin VB.Label lblMac 
      Caption         =   "MAC Address:"
      Height          =   255
      Left            =   300
      TabIndex        =   4
      Top             =   780
      Width           =   1815
   End
   Begin VB.Label lblName 
      Caption         =   "Display Name:"
      Height          =   255
      Left            =   300
      TabIndex        =   2
      Top             =   300
      Width           =   1815
   End
End
Attribute VB_Name = "frmNew"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit

Private Sub Label1_Click()

End Sub


Private Sub CancelButton_Click()
Unload Me
End Sub


Private Sub OKButton_Click()

Dim i As Integer
Dim str_HostName As String

If Me.txtName = "" Then
    MsgBox "Name Address must be entered!", vbCritical, "Error"
    Exit Sub
End If

If Me.txtIP = "" Then
    MsgBox "IP Address must be entered!", vbCritical, "Error"
    Exit Sub
End If

If Me.txtMAC = "" Then
    MsgBox "MAC Address must be entered!", vbCritical, "Error"
    Exit Sub
End If

If Val(Me.Tag) > 0 Then

    i = Val(Me.Tag)
        
    ProfileSaveItem "Host_" & i, "Name", Me.txtName
    ProfileSaveItem "Host_" & i, "IP_Address", Me.txtIP
    ProfileSaveItem "Host_" & i, "MAC_Address", UCase(Replace(Replace(Me.txtMAC, "-", ":"), ".", ":"))


Else

    For i = 1 To Val(ProfileGetItemSaveDefault("Settings", "MaxHosts", "99"))
        
        str_HostName = ProfileGetItem("Host_" & i, "Name", "")
        
        If str_HostName = "" Then
        
            ProfileSaveItem "Host_" & i, "Name", Me.txtName
            ProfileSaveItem "Host_" & i, "IP_Address", Me.txtIP
            ProfileSaveItem "Host_" & i, "MAC_Address", Me.txtMAC
        
            Exit For
        
        End If
    Next i

End If

Unload Me


End Sub


